
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta content="" name="description"/>
    <meta content="webthemez" name="author"/>
    <title>短信记录</title>
    <link rel='stylesheet' type='text/css' href='../../css/bootstrap2.min.css'>
	<link rel="stylesheet"
	href="../../assets/bootstrap-table/bootstrap.min.css"><!-- 必须注意引入顺序  -->
	<link rel="stylesheet"
	href="../../assets/bootstrap-table/bootstrap-table.css">
	<link rel="stylesheet"
	href="../../assets/bootstrap-table/bootstrap-editable.css">
	<script src="../../assets/bootstrap-table/jquery.min.js"></script>
	<script src="../../assets/bootstrap-table/bootstrap.min.js"></script>
	<script src="../../assets/bootstrap-table/bootstrap-table.js"></script>
	<script src="../../assets/bootstrap-table/bootstrap-table-export.js"></script>
	<script src="../../assets/bootstrap-table/tableExport.js"></script>
	<script src="../../assets/bootstrap-table/bootstrap-table-editable.js"></script>
	<script src="../../assets/bootstrap-table/bootstrap-editable.js"></script>
	<script src="../../js/bootstrap-table-zh-CN.min.js"></script>
    <script src="../../js/bootstrap-table-zh-CN.min.js"></script>
    <script type="text/javascript" src="../../bootstrap/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>

	
	<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
	
	<link rel="stylesheet" href="../../weixinUI/style/weui.css"/>
	
</head>

<body>
        <div class="header">
            <h1 class="page-header">短信记录</h1>
        </div>


			<div id="toolbar" class="btn-group">
                    <button  class="btn btn-default dropdown-toggle " type="button" data-toggle="dropdown">
                                          <span id="day">全部时间</span><span class="caret"></span>
                   </button>		 
			</div>

        <div id="page-inner">
            <div class="row">
                <div class="col-xs-12">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table id="table" class="table " data-toggle="table" data-toolbar="#toolbar"
                                       data-url="/shambles/mobile/asset/getPreMessage.do?time=0" data-search="true"
                                       data-striped="true" data-toolbar="#toolbar"
                                       data-show-refresh="false" data-show-toggle="false"
                                       data-side-pagination="server" data-pagination="true"
                                       data-show-columns="false" data-sort-order="desc">
                                    <thead>
                                    <tr>
                                    	<th data-align="left" data-field="phoneWho" data-sortable="true">姓名</th>
                                        <th data-align="left" data-field="phone" >电话号码</th>
                                        <th data-align="left" data-field="message">内容</th>
                                        <th data-align="left" data-field="optAdd" >操作人</th>
                                        <th data-align="left" data-field="state" data-formatter="statusFormatter" data-sortable="true">状态</th>
                                        <th data-align="left" data-field="optDate"  data-formatter="actionTime" data-sortable="true">发送时间</th>
                                    </tr>
                                    </thead>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


	<div id="actionSheet_wrap">
		<div class="weui_mask_transition" id="mask" style="display: none;"></div>
		<div class="weui_actionsheet" id="weui_actionsheet">
			<div class="weui_actionsheet_menu">
			           <div class="weui_actionsheet_cell" id="today" >今天</div>
                       <div class="weui_actionsheet_cell" id="week" >一周内</div>
                       <div class="weui_actionsheet_cell" id="month" >一月内</div>
                       <div class="weui_actionsheet_cell" id="all" >全部日期</div>
			</div>
			<div class="weui_actionsheet_action">
				<div class="weui_actionsheet_cell" id="actionsheet_cancel">取消</div>
			</div>
		</div>
	</div>

	</div>
<!-- 警告对话框 -->
<div class="modal fade" id="alertdialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header blue">
                <div>
                    <strong id="alertchar" style="font-size:20px"></strong>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
                    <button type="button" id="commitFoodDataButton" class="btn btn-primary">添 加</button>
                </div>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
 
    function getcookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if (arr = document.cookie.match(reg))
            return unescape(arr[2]);
        else
            return null;
    }


    var url="/shambles/mobile/asset/getPreMessage.do?time=0";
    
	 $('#toolbar').on('click', function () {
		 document.getElementById("actionSheet_wrap").style.display="block";
         var mask = $('#mask');
         var weuiActionsheet = $('#weui_actionsheet');
         weuiActionsheet.addClass('weui_actionsheet_toggle');
         mask.show()
             .focus()//加focus是为了触发一次页面的重排(reflow or layout thrashing),使mask的transition动画得以正常触发
             .addClass('weui_fade_toggle').one('click', function () {
             hideActionSheet(weuiActionsheet, mask);
         });
         $('#actionsheet_cancel').one('click', function () {
             hideActionSheet(weuiActionsheet, mask);
         });
         mask.unbind('transitionend').unbind('webkitTransitionEnd');

         function hideActionSheet(weuiActionsheet, mask) {
             weuiActionsheet.removeClass('weui_actionsheet_toggle');
             mask.removeClass('weui_fade_toggle');
             mask.on('transitionend', function () {
                 mask.hide();
             }).on('webkitTransitionEnd', function () {
                 mask.hide();
             })
         }
     });
    
    $("#today").on("click",function(){
    	console.log("today");
    	document.getElementById("actionSheet_wrap").style.display="none";
    	document.getElementById("day").innerText = "今天";
    	var url="/shambles/mobile/asset/getPreMessage.do?time=1";
    	$(" #table").bootstrapTable('refresh',{
			url : url
		});
    });

    $("#week").on("click",function(){
    	console.log("week");
    	document.getElementById("actionSheet_wrap").style.display="none";
    	document.getElementById("day").innerText = "一周内";
    	var url="/shambles/mobile/asset/getPreMessage.do?time=2";
    	$(" #table").bootstrapTable('refresh',{
			url : url
		});    	
    });
    
    $("#month").on("click",function(){
    	console.log("month");
    	document.getElementById("actionSheet_wrap").style.display="none";
    	document.getElementById("day").innerText = "一月内";
    	var url="/shambles/mobile/asset/getPreMessage.do?time=3";
    	$(" #table").bootstrapTable('refresh',{
			url : url
		});    	        
    });
    
    $("#all").on("click",function(){
    	console.log("today");
    	document.getElementById("actionSheet_wrap").style.display="none";
    	document.getElementById("day").innerText = "全部时间";
    	url="/shambles/mobile/asset/getPreMessage.do?time=0";
    	$(" #table").bootstrapTable('refresh',{
			url : url
		});    	        
    });
    
    function actionReport(value, row, index) {
    		return [
                	// '<a  href="javascript:void(0)" onclick="report(this);" title="点击查看征信报告">',
                	// '&nbsp;<img src="img/detail.jpg" width="25px" height="25px">&nbsp;',
                	// '</a>&nbsp;',
                	'<button type="button" title="查看详情"  class="btn btn-success">查看详情</button>'
            		].join('');
    }

 
    
    function actionUser(value, row, index) {
        return [
            '<a  href="javascript:void(0)" title="点击查看用户详情">',
            value,
            '</a>'].join('');
    }
    
       
    function actionAddress(value, row, index) {
        return [
            '<a  href="javascript:void(0)"  title="点击查看用户详情">',
            value,
            '</a>'].join('');
    }
    
	function statusFormatter(value, row, index) {    	        
    	if (value == "发送成功"){
    		return "<font color='#3eb94e'>"+value+"</font>";
    	}else if (value == "发送失败"){
    		return "<font color='#FF0000'>"+value+"</font>";
    	}else{
    		return value;
    	}    	
    }
    
    function actionTime(value, row, index){
        var date = new Date(value);
        Y = date.getFullYear() + '-';
        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        D = date.getDate() + ' ';
        h = date.getHours() + ':';
        m = date.getMinutes() + ':';
        s = date.getSeconds();
        return Y+M+D+h+m+s;
    }

</script>
</body>

</html>